package thread.test04.demo02;

import java.util.concurrent.Callable;

/**
 * ClassName: MyCallable
 * Description:
 *
 * @Author zjl
 * @Create 2025/03/11 19:43
 * @Version 1.0
 */
public class MyCallable implements Callable<Integer> {
    private int tickets = 50;


    @Override
    public Integer call() throws Exception {
        while (true){
            if (tickets > 0){
                System.out.println(Thread.currentThread().getName() + "正在出售第" + tickets-- + "张票");
            }else {
                break;
            }
        }
        return tickets;
    }
}
